<?php
/**
 * Created by PhpStorm.
 * User: hhcyc
 * Date: 2018/4/4
 * Time: 22:28
 */


/**
 * __DIR__当前目录
 * PHP_EOL 换行
 * swoole_async_readfile最大可读取4M的文件，受限于SW_AIO_MAX_FILESIZE宏
 * swoole_async_read 读大文件，每次读一小段内容
 */

// 类方式使用 Swoole\Async::readfile
$bool = swoole_async_readfile(__DIR__ . "/1.txt", function ($filename, $fileContent){
    echo "filename:".$filename.PHP_EOL;
    echo "content:".$fileContent.PHP_EOL;
});

var_dump($bool);

echo "start".PHP_EOL;